import LogicFlow from "@logicflow/core";
import {DndPanel, SelectionSelect} from "@logicflow/extension";
const setPatternItems = (lf:LogicFlow)=>{
    (lf.extension.dndPanel as DndPanel).setPatternItems([
        {
            label: '选区',
            icon: '',
            callback: () => {
                (lf.extension.selectionSelect as SelectionSelect).openSelectionSelect();
                lf.once('selection:selected', () => {
                    (lf.extension.selectionSelect as SelectionSelect).closeSelectionSelect();
                });
            }
        },
        {
            type: "start",
            text: "开始",
            label: "开始",
            icon:
                ""
        },
        {
            type: "userTask",
            label: "任务",
            text: "任务",
            icon:
                "",
            className: "important-node",
            properties: {
                disabled: true
            }
        },
        {
            type: "concurrent",
            label: "并行网关",
            icon:
                "",
            className: "import_icon"
        },
        {
            type: "push",
            label: "互斥网关",
            icon:
                ""
        },
        {
            type: "condition",
            label: "条件网关",
            icon:
                ""
        },
        {
            type: "end",
            text: "结束",
            label: "结束",
            icon:
                ""
        }
    ]);
}

const setTheme = (lf:LogicFlow) => {
    lf.setTheme({
        circle: {
            stroke: '#000000',
            strokeWidth: 1,
            outlineColor: '#88f',
        },
        rect: {
            outlineColor: '#88f',
            strokeWidth: 1,
        },
        polygon: {
            strokeWidth: 1,
        },
        polyline: {
            stroke: '#000000',
            hoverStroke: '#000000',
            selectedStroke: '#000000',
            outlineColor: '#88f',
            strokeWidth: 1,
        },
        nodeText: {
            color: '#000000',
        },
        edgeText: {
            color: '#000000',
            background: {
                fill: '#f7f9ff',
            },
        },
    });
}

export {setPatternItems,setTheme}
